Skip to content

Do not emit separator before elements for Intersperse on non-fused iterators#152855

Closed
zakarumych wants to merge 1 commit intorust-lang:mainfrom
zakarumych:defused-intersperse
Closed

Do not emit separator before elements for Intersperse on non-fused iterators#152855
zakarumych wants to merge 1 commit intorust-lang:mainfrom
zakarumych:defused-intersperse

Conversation

@zakarumych
Copy link
Copy Markdown
Contributor

This change is related to unstable feature #![feature(iter_intersperse)]
#79524

What this does is changes behavior of Intersperse on non Fused iterators.
Particularly in case of iterator that returns None once from next method and then proceeds to yield elements normally.
Without this change the Intersperse will also return None, but then it will yield separator before first actual element from inner iterator.
This change fixes that, so even if underlying iterator starts with Nones, Intersperse waits for one item to be returned before inserting separators.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants